<div id="menu_first_level">
	<?php $this->widget('zii.widgets.CMenu',array(
		'id' => 'menu_first_level_ul',
		'activeCssClass' => 'cm-active',
		'items' => $this->menu,
		'encodeLabel' => false,
	)); ?>
</div>

<div id="menu_second_level">
	<?php foreach ($this->submenu as $k => $v) {

		$this->widget('zii.widgets.CMenu',array(
			'id' => 'elements_'.$k,
			'activeCssClass' => 'cm-active',
			'lastItemCssClass' => 'no-border',
			'items' => $v,
			'encodeLabel' => false,
			'htmlOptions' => array(
				'class' => strpos($this->activeMenu, $k) === 0 ? 'clear' : 'hidden clear',
			),
		));

	} ?>
</div>

<script type="text/javascript">
//<![CDATA[
function fn_switch_tab(section)
{
	$('#menu_second_level ul').each(function(){
		var self = $(this);
		self.toggleBy(self.attr('id') != 'elements_' + section)
	});

	$('#menu_first_level_ul li').each(function(){
		var self = $(this);
		if (self.attr('id') != 'tabs_' + section) {
			self.removeClass('cm-active');
		} else {
			self.addClass('cm-active');
		}
	});
	return false;
}
//]]>
</script>